package org.eclipse.moquette.spi.impl.events;

import org.eclipse.moquette.proto.Utils;
import org.eclipse.moquette.proto.messages.AbstractMessage;
import org.eclipse.moquette.server.ServerChannel;

/**
 * 传入的COMMON协议事件
 * Created by alex on 15-6-1.
 */
public class ProtocolEvent extends MessagingEvent {

    ServerChannel m_session;
    AbstractMessage message;

    public ProtocolEvent(ServerChannel session, AbstractMessage message) {
        this.m_session = session;
        this.message = message;
    }

    public ServerChannel getSession() {
        return m_session;
    }

    public AbstractMessage getMessage() {
        return message;
    }

    @Override
    public String toString() {
        return "ProtocolEvent wrapping " + Utils.msgType2String(message.getMessageType());
    }
}
